package com.mocha.controller;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.mocha.bean.User;
import com.mocha.service.UserService;

@Controller
public class UserController {
	
	private static final Logger LOGGER = Logger.getLogger(UserController.class);
	
	@Autowired
	private UserService userservice;
	
	
	@RequestMapping(value = "/user" , method = RequestMethod.GET)
	public String getUserList(Model model){
		List<User> queryUser = userservice.queryUser();
		LOGGER.info("queryUser:"+queryUser);
		model.addAttribute("queryUser", queryUser);
		return "index";
	}
	
}
